package unilearn.generate;

import java.io.PrintWriter;

/*
 * GenerateFileData.java
 *
 * Created on 29 April 2008, 21:42
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

/**
 * @author Ben
 */
public class GenerateFileData
{

	public static final String INSERT_FILE = "INSERT INTO dataFile (fileName,fileType,fileSize) "
			+ " VALUES ('%1_%2.txt','text/html',128);";

	private long createdFiles = 0;

	private PrintWriter writer;

	/** Creates a new instance of GenerateFileData */
	public GenerateFileData(PrintWriter writer)
	{
		this.writer = writer;
	}

	public long addFileData(String tableName, long primaryID)
	{
		createdFiles++;
		String value = INSERT_FILE;
		value = value.replace("%1", tableName);
		value = value.replace("%2", String.valueOf(primaryID));
		writer.println(value);
		return createdFiles;
	}

	public void close()
	{
		// TODO
	}
}
